package cn.com.idmy.auth;

public class MfaManager {
    /*protected static final String STORAGE_VALUE = "two.enabled";

    private static TwoManager instance = new TwoManager();

    public static void setInstance(TwoManager val) {
        instance = val;
        GlobalConfig.putAuthManager(val);
        EventBus.doSetAuthManager(instance);
    }

    public static TwoManager getInstance() {
        return instance;
    }

    protected String getKey(String token, String key) {
        return getGlobalProps().getTokenName() + ":" + ContextManager.getAccountSystem() + ":two:" + key + ":" + token;
    }

    public void open(String token, String key, long timeout) {
        LoginManager.getInstance().check();
        authDao().set(getKey(token, key), STORAGE_VALUE, timeout);
        EventBus.doOpenTwo(token, key, timeout);
    }

    public boolean isTwo(String token, String key) {
        var value = authDao().get(getKey(token, key));
        return StrUtil.isNotBlank(value);
    }

    public void check(String token, AuthTwo at) {
        this.check(token, at.value());
    }

    public void check(String token, String key) {
        if (!isTwo(token, key)) {
            throw new NotTwoException(token, key).setCode(SaErrorCode.CODE_11071);
        }
    }

    public long getTimeout(String token, String key) {
        return authDao().getTimeout(getKey(token, key));
    }

    public void close(String token, String key) {
        authDao().delete(getKey(token, key));
        EventBus.doCloseTwo(token, key);
    }*/
}
